package com.reggie.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.reggie.common.R;
import com.reggie.entiry.Orders;
import com.reggie.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/submit")
    public R<String> submit(@RequestBody Orders orders) {
        log.info("订单数据: {}",orders);

        orderService.submit(orders);

        return R.success("下单成功");
    }
    @GetMapping("/userPage")
    public R<Page> list(int page,int pageSize) {
        Page<Orders> pageInfo = new Page<>(page,pageSize);
       orderService.page(pageInfo);
       return R.success(pageInfo);

    }

}
